package com.example.library_demo.mapper;

import com.example.library_demo.dto.circulation.MyBorrowDTO;
import com.example.library_demo.entity.Circulation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Eric
 * @since 2024-11-27
 */
public interface CirculationMapper extends BaseMapper<Circulation> {


    @Select("SELECT c.*,b.name FROM l_circulation c left join l_book b on c.book_id = b.book_id where c.user_id= #{userId} order by c.status asc")
    List<MyBorrowDTO> selectMyBorrowByUserIdAndCirculationId(long userId);

}
